home *** CD-ROM | disk | FTP | other *** search
- /********************************************************/
- /*
- Player PRO 4.5.2 -- Music Driver EXAMPLE
-
- Library Version 4.02
-
- To use with Think C & CodeWarrior
-
- Antoine ROSSET
- 16 Tranchees
- 1206 GENEVA
- SWITZERLAND
-
- FAX: (+41 22) 346 11 97
- PHONE: (+41 89) 203 74 62
- Email: rosset@dial.eunet.ch
- */
- /********************************************************/
-
- #include "RDriver.h" // Mad Driver functions & globals
-
- /*****************************/
- /****** MAIN FUNCTION ********/
- /*****************************/
-
- void main( void)
- {
- Boolean End = false;
-
- /*************** ****************/
- /****** Toolbox Initialization **********/
- /*************** ****************/
-
- InitGraf( &qd.thePort);
- InitFonts();
- InitWindows();
- InitMenus();
- TEInit();
- InitDialogs(0L);
- InitCursor();
- MaxApplZone();
- MoreMasters();
-
- /*******************************************************************************************/
- /****** MAD Library Initialisation : choose the best driver for the current hardware ******/
- /****** ******/
- /****** Standard initialization with 4 channels... ******/
- /*******************************************************************************************/
-
- {
- MADDriverSettings init;
-
-
- /*
- MANUAL DRIVER CONFIGURATION, by example:
-
- init.numChn = 4;
- init.outPutBits = 8;
- init.outPutRate = rate22khz;
- init.outPutMode = StereoOutPut;
- init.driverMode = SoundManagerDriver;
- init.antiAliasing = false;
- init.repeatMusic = false;
- init.Interpolation = false;
- init.MicroDelay = false;
- init.MicroDelaySize = 35;
- init.surround = false;
- init.sysMemory = false;
- init.Reverb = false;
- init.ReverbSize = 45;
- init.ReverbStrength = 60;
- init.ReverbStrength = 60;
- init.TickRemover = false;
- */
-
- /* or AUTOMATIC DRIVER CONFIGURATION FOR CURRENT MAC HARDWARE*/
- MADGetBestDriver( &init);
-
- if( MADInitLibrary( "\pPlugs", init.sysMemory) != noErr) DebugStr("\pSmall Problem...");
- if( MADCreateDriver( &init) != noErr) DebugStr("\pSmall Problem...");
- }
- /*********************************/
- /*********************************/
- /*********************************/
-
- /****** Open a music file via Plugs ********/
- while( End == false)
- {
- StandardFileReply reply;
- SFTypeList aType;
-
- FlushEvents( everyEvent, 0);
-
- StandardGetFile( 0L, -1, aType, &reply);
-
- if( !reply.sfGood) End = true;
- else
- {
- if( MADPlugAvailable( reply.sfType)) // Is available a plug to open this file?
- {
- if( MADImportMusicFSpFile( reply.sfType, &reply.sfFile) == noErr) // Load this music with help of Plugs
- // in application folder, in 'Plugs' folder or internal resources
- {
- MADPlay(); // Turn interrupt driver function ON
- MADDriver->Reading = true; // Read the current partition in memory
-
- while( !Button())
- {
- /// Do what you want here....
- /// Bla bla...
- /// By example: Run your realtime 3D game
- /// with 24bit texture mapping...
-
- long fT, cT;
-
- MADGetMusicStatus( &fT, &cT); // Some infos about current music
- }
- MADDriver->Reading = false; // Stop reading current partition
- MADStop(); // Stop driver interrupt function
-
- MADDisposeMusic(); // Dispose the current music
-
- }
- }
- }
- }
- MADDisposeDriver(); // Dispose music driver
- MADDisposeLibrary(); // Close music library
- FlushEvents( everyEvent, 0); // Kill your events and byebye...
- }